package flappy.Game;

import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.InputProcessor;

import flappy.VatThe.Chim;

public class InputHandler implements InputProcessor {
	private Chim      chim;
	private GameWorld game;
	
	public InputHandler(GameWorld game, float x, float y) {
		this.game = game;
		chim = game.chim;
		
	}
	
	void XuLyCham() {
		chim.bayLen();
		switch (game.TrangThai) {
			case DangChoi:
				chim.bayLen();
				break;
			case SanSang:
				game.batDau();
				break;
			case ChaoMung:
				game.sanSang();
				break;
			case GameOver:
				game.khoiTaoLai();
				break;
			case XemDiem:
				game.khoiTaoLai();
				break;
			default:
				break;
		}
		
	}
	
	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		XuLyCham();
		return false;
	}
	
	@Override
	public boolean touchUp(int screenX, int screenY, int pointer, int button) {
		return false;
	}
	
	@Override
	public boolean keyDown(int keycode) {
		if (keycode == Keys.SPACE) {
			XuLyCham();
		}
		return false;
	}
	
	@Override
	public boolean keyUp(int keycode) {
		return false;
	}
	
	@Override
	public boolean keyTyped(char character) {
		return false;
	}
	
	@Override
	public boolean touchDragged(int screenX, int screenY, int pointer) {
		return false;
	}
	
	@Override
	public boolean mouseMoved(int screenX, int screenY) {
		return false;
	}
	
	@Override
	public boolean scrolled(int amount) {
		return false;
	}
}
